﻿using MediatR;
using RBAC.LuFang.API.Application.Command.RoleCommand;
using RBAC.LuFang.API.Application.Command.RoleMenuCommand;
using RBAC.LuFang.Domain;
using RBAC.LuFang.Domin.Services;
using static RBAC.LuFang.Domin.Services.RoleMenuService;

namespace RBAC.LuFang.API.Application.CommandHandlers.RoleMenuHandler
{
    //角色菜单：显示角色
    public class RoleMenuCommandHandler : IRequestHandler<RolesSelectCommand, List<Menutun1>>
    {
        private readonly IRoleMenuService _roleMenuService;

        public RoleMenuCommandHandler(IRoleMenuService roleMenuService)
        {
            _roleMenuService = roleMenuService;
        }

        public async Task<List<Menutun1>> Handle(RolesSelectCommand request, CancellationToken cancellationToken)
        {
            return await _roleMenuService.GetRole();
        }
    }
}
